home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 19
/
CD_ASCQ_19_010295.iso
/
dos
/
prg
/
pas
/
swag
/
win_os2.swg
/
0037_Using VER.DLL.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-08-25
|
2KB
|
49 lines
{
From: ZWEITZE@et.tudelft.nl (Zweitze de Vries)
>Does anyone have examples of installation programs that use
>the file installation library (VER.DLL) in BP7?
Since all installation programs do the same thing, why reinvent
the wheel? Just buy one, it should be cheaper than developing
your own. There are also some share/freeware apps around (try CICA).
In respect to your question, I have some code that fills a dialog
box ('About...') according to the version information resource:
}
procedure THelpAbout.SetUpWindow;
var
lVerInfoSize: LongInt;
lVerHandle: LongInt;
szModuleName: array [0..fsPathName] of Char;
pVerData: PChar;
Buffer: Pointer;
lenBuffer: Word;
begin
TDialog.SetupWindow;
GetModuleFileName(hInstance, szModuleName, SizeOf(szModuleName));
lVerInfoSize := GetFileVersionInfoSize(szModuleName, lVerHandle);
if lVerInfoSize = 0 then Exit;
GetMem(pVerData, lVerInfoSize);
if not GetFileVersionInfo(szModuleName, lVerHandle, lVerInfoSize, pVerData)
then Exit;
if VerQueryValue(pVerData, '\StringFileInfo\CATE\ProductName',
Buffer, LenBuffer)
and (LenBuffer <> 0)
then SetDlgItemText(hWindow, stat_AppName, Buffer);
if VerQueryValue(pVerData, '\StringFileInfo\CATE\ProductVersion',
Buffer, LenBuffer)
and (LenBuffer <> 0)
then SetDlgItemText(hWindow, stat_AppVersion, Buffer);
if VerQueryValue(pVerData, '\StringFileInfo\CATE\CompanyName',
Buffer, LenBuffer)
and (LenBuffer <> 0)
then SetDlgItemText(hWindow, stat_AppCompany, Buffer);
if VerQueryValue(pVerData, '\StringFileInfo\CATE\LegalCopyright',
Buffer, LenBuffer)
and (LenBuffer <> 0)
then SetDlgItemText(hWindow, stat_AppCopyright, Buffer);
FreeMem(pVerData, lVerInfoSize);
end;